const HOST = "http://192.168.0.8:8082"
const WSHOST = "192.168.0.8:8082"

// 获取不同页面的轮播
function getLunbo (page) {
	$.ajax({
		url:`${HOST}/h5/lunbo`,
		data:{"type":page},
		success: (res) => {
			if(res.code==200 && res.data.length>0)
			{	
				for (let i = 0; i < res.data.length; i++) {
					let s=`<div class="swiper-slide"><img src="${HOST}/upload/${res.data[i].imgsrc}" ></div>`;
					$("#lunbo .swiper-wrapper").append(s);
				}
				
			}else{
				let s=`<div class="swiper-slide"><img src="img/true.jpg" ></div>`;
				$("#lunbo .swiper-wrapper").append(s);
			}
			var swiper = new Swiper('#lunbo', {
					autoplay: true,//可选选项，自动滑动
				});	
		}
		})
}
if(localStorage.getItem("logo-name")!='null'){
	document.title = localStorage.getItem("logo-name");
	$(".logo-name").html(localStorage.getItem("logo-name"));
	$(".slogan").html(localStorage.getItem("slogan"));
	$(".logo-img img").attr("src",localStorage.getItem("logo-img"));
	$("#qrcode").attr("src",localStorage.getItem("scholl-qrcode"));
	$("#tel").attr('href','tel:'+localStorage.getItem("slogan"));
	$("#address").html(localStorage.getItem("address"));
	$(".info-box .tel span").html(localStorage.getItem("slogan"))
	$(".info-box .msg span").html(localStorage.getItem("slogan"))
	$(".info-box .position span").html(localStorage.getItem("address"))
}else{
	// 读取网站配置信息
		$.ajax({
			url:`/h5/config`,
			success:function(res){
				if(res.code==200){
					$(".logo-name").html(res.data[0].value);
					$(".slogan").html(res.data[1].value);
					if(res.data[4].value!=null)
						$(".logo-img img").attr("src",'/upload/'+res.data[4].value);
					$("#tel").attr('href','tel:'+res.data[1].value);
					$("#address").html(res.data[3].value);
					$("#qrcode").attr("src",res.data[5].value);
					$("#beian").html(res.data[6].value);
					if(res.data[0].value!=null)
						document.title = res.data[0].value;
					localStorage.setItem("logo-name",res.data[0].value)
					localStorage.setItem("slogan",res.data[1].value)
					localStorage.setItem("logo-img",'/upload/'+res.data[4].value)
					localStorage.setItem("address",res.data[3].value)
					localStorage.setItem("beian",res.data[6].value)
					localStorage.setItem("zuobiao",res.data[7].value)
					localStorage.setItem("scholl-qrcode",'/upload/'+res.data[5].value)
	
				}
			}
		})
}

